home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / oath.lha / oath / src / bag.cc next >
C/C++ Source or Header  |  1991-08-29  |  2KB  |  60 lines

  1. //***************************************************************************
  2. //             OATH :: Object-oriented Abstract Type Hierarchy
  3. //***************************************************************************
  4. //
  5. //  Copyright (C) 1991, 1990  Texas Instruments Incorporated
  6. //  Permission is granted to any individual or institution
  7. //  to use, copy, modify, and distribute this software,
  8. //  provided that this complete copyright and permission notice
  9. //  is maintained, intact, in all copies and supporting documentation.
  10. //
  11. //  Texas Instruments Incorporated provides this software "as is"
  12. //  without express or implied warranty.
  13. //
  14. //***************************************************************************
  15. //  bag (bagA, bagG)
  16. //
  17. //  History:
  18. //    07/91  Brian M Kennedy  utility functions: deepCopy, flatten
  19. //    06/91  Brian M Kennedy  New macros & format; remove printDiagnostic
  20. //    10/90  Brian M Kennedy  Major Rewrite
  21. //    02/90  Brian M Kennedy  Original
  22. //
  23. //***************************************************************************
  24.  
  25. #include "copyright.h"
  26.  
  27. #include <oath/bag.h>
  28.  
  29. #include <oath/pdlQueue.h>
  30.  
  31. /////////////////////////////////////////////////////////////////////////////
  32. // bag Outline Definitions
  33.  
  34. OUTLINES(bag, obj)
  35.  
  36.  
  37. /////////////////////////////////////////////////////////////////////////////
  38. // Utility functions
  39.  
  40.     objA
  41. deepCopy (objA O)
  42.    {bagA B = bagA::isa(O);
  43.     if(!B)
  44.         return O.makeCopy();
  45.     else
  46.         return B.make(deepCopy);
  47.    }
  48.  
  49.     bagA
  50. flatten (objA O)
  51.    {bagA B = bagA::isa(O);
  52.     if(!B)
  53.         return pdlQueueA::make() << O;
  54.     else
  55.         return B;
  56.    }
  57.  
  58.  
  59. //***************************************************************************
  60.